package com.sumainfor.pc.market.service.tenant.impl;


import com.sumainfor.common.util.JsonResult;
import com.sumainfor.pc.market.dao.tenant.PayBillMapper;
import com.sumainfor.pc.market.feign.GmioFeign.GmioFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 功能描述:
 *
 * @Auther: zhlu
 * @Date: 2019/4/28 15:53
 * @Description:
 */
@Service
public class PayBillService {

    @Autowired
    PayBillMapper PayBillMapper;

    @Autowired
    GmioFeign GmioFeign;

    /**
     * 功能描述: 
     * 根据账单资料房源资料获取房源信息
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/4/28 15:55
     */
    public Map<String,Object> getTrenantBillHousing(Map<String,Object>params){
        JsonResult jsonResult=GmioFeign.getTrenantBill(params);
        if(jsonResult.isSuccess()==false){
            return jsonResult;
        }
        //根据账单编号获取账单基本资料
        Map<String,Object>getTrenantBill=(Map<String,Object>)jsonResult.getResult();
        //根据账单资料房源资料获取房源信息
        Map<String,Object> getTrenantBillHousing=PayBillMapper.getTrenantBillHousing(getTrenantBill);
        getTrenantBillHousing.putAll(getTrenantBill);
        return getTrenantBillHousing;
    }

    /**
     * 根据合同编号获取合同详情
     * @param params
     * @return
     */
    public JsonResult getPaIdChaId(Map<String,Object> params){
        JsonResult result = new JsonResult();
        return result.put(PayBillMapper.getPaIdChaId(params));
    }

}
